home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / AIncludes / Devices.a < prev    next >
Encoding:
Text File  |  1995-04-18  |  12.1 KB  |  401 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Devices.a
  3. ;
  4. ;    Contains:    Device Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__DEVICES__') = 'UNDEFINED' THEN
  21. __DEVICES__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__OSUTILS__') = 'UNDEFINED' THEN
  25.     include 'OSUtils.a'
  26.     ENDIF
  27. ;        include 'Types.a'                                            ;
  28. ;            include 'ConditionalMacros.a'                            ;
  29. ;        include 'MixedMode.a'                                        ;
  30. ;        include 'Memory.a'                                            ;
  31.  
  32.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  33.     include 'Files.a'
  34.     ENDIF
  35.  
  36.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  37.     include 'Quickdraw.a'
  38.     ENDIF
  39. ;        include 'QuickdrawText.a'                                    ;
  40.  
  41.     IF &TYPE('__EVENTS__') = 'UNDEFINED' THEN
  42.     include 'Events.a'
  43.     ENDIF
  44.  
  45.     IF &TYPE('__DIALOGS__') = 'UNDEFINED' THEN
  46.     include 'Dialogs.a'
  47.     ENDIF
  48. ;        include 'Errors.a'                                            ;
  49. ;        include 'Windows.a'                                        ;
  50. ;            include 'Controls.a'                                    ;
  51. ;                include 'Menus.a'                                    ;
  52. ;        include 'TextEdit.a'                                        ;
  53.  
  54. chooserInitMsg                    EQU        11                    ; the user selected this device package 
  55. newSelMsg                        EQU        12                    ; the user made new device selections 
  56. fillListMsg                        EQU        13                    ; fill the device list with choices 
  57. getSelMsg                        EQU        14                    ; mark one or more choices as selected 
  58. selectMsg                        EQU        15                    ; the user made a selection 
  59. deselectMsg                        EQU        16                    ; the user canceled a selection 
  60. terminateMsg                    EQU        17                    ; allows device package to clean up 
  61. buttonMsg                        EQU        19                    ; the user selected a button 
  62.  
  63. ; Values of the 'caller' parameter to a Chooser device package 
  64. chooserID                        EQU        1
  65.  
  66. ; Values of the 'message' parameter to a Control Panel 'cdev' 
  67. initDev                            EQU        0                    ;Time for cdev to initialize itself
  68. hitDev                            EQU        1                    ;Hit on one of my items
  69. closeDev                        EQU        2                    ;Close yourself
  70. nulDev                            EQU        3                    ;Null event
  71. updateDev                        EQU        4                    ;Update event
  72. activDev                        EQU        5                    ;Activate event
  73. deactivDev                        EQU        6                    ;Deactivate event
  74. keyEvtDev                        EQU        7                    ;Key down/auto key
  75. macDev                            EQU        8                    ;Decide whether or not to show up
  76. undoDev                            EQU        9
  77. cutDev                            EQU        10
  78. copyDev                            EQU        11
  79. pasteDev                        EQU        12
  80. clearDev                        EQU        13
  81. cursorDev                        EQU        14
  82.  
  83. ; Special values a Control Panel 'cdev' can return 
  84. cdevGenErr                        EQU        -1                    ;General error; gray cdev w/o alert
  85. cdevMemErr                        EQU        0                    ;Memory shortfall; alert user please
  86. cdevResErr                        EQU        1                    ;Couldn't get a needed resource; alert
  87. cdevUnset                        EQU        3                    ; cdevValue is initialized to this
  88.  
  89. ; Values of the 'message' parameter to a Monitor 'mntr' 
  90. initMsg                            EQU        1                    ;initialization
  91. okMsg                            EQU        2                    ;user clicked OK button
  92. cancelMsg                        EQU        3                    ;user clicked Cancel button
  93. hitMsg                            EQU        4                    ;user clicked control in Options dialog
  94. nulMsg                            EQU        5                    ;periodic event
  95. updateMsg                        EQU        6                    ;update event
  96. activateMsg                        EQU        7                    ;not used
  97. deactivateMsg                    EQU        8                    ;not used
  98. keyEvtMsg                        EQU        9                    ;keyboard event
  99. superMsg                        EQU        10                    ;show superuser controls
  100. normalMsg                        EQU        11                    ;show only normal controls
  101. startupMsg                        EQU        12                    ;code has been loaded
  102.  
  103. ; control codes for DeskAccessories 
  104. goodbye                            EQU        -1                    ; heap being reinitialized 
  105. killCode                        EQU        1                    ; KillIO requested 
  106. accEvent                        EQU        64                    ; handle an event 
  107. accRun                            EQU        65                    ; time for periodic action 
  108. accCursor                        EQU        66                    ; change cursor shape 
  109. accMenu                            EQU        67                    ; handle menu item 
  110. accUndo                            EQU        68                    ; handle undo command 
  111. accCut                            EQU        70                    ; handle cut command 
  112. accCopy                            EQU        71                    ; handle copy command 
  113. accPaste                        EQU        72                    ; handle paste command 
  114. accClear                        EQU        73                    ; handle clear command 
  115.  
  116. ; Control/Status Call Codes 
  117. drvStsCode                        EQU        8                    ; status call code for drive status 
  118. ejectCode                        EQU        7                    ; control call eject code 
  119. tgBuffCode                        EQU        8                    ; set tag buffer code 
  120.  
  121. ; miscellaneous Device Manager constants 
  122. ioInProgress                    EQU        1                    ; predefined value of ioResult while I/O is pending 
  123. aRdCmd                            EQU        2                    ; low byte of ioTrap for Read calls 
  124. aWrCmd                            EQU        3                    ; low byte of ioTrap for Write calls 
  125. asyncTrpBit                        EQU        10                    ; trap word modifier 
  126. noQueueBit                        EQU        9                    ; trap word modifier 
  127.  
  128. ; flags used in the driver header and device control entry 
  129. dReadEnable                        EQU        0                    ; set if driver responds to read requests 
  130. dWritEnable                        EQU        1                    ; set if driver responds to write requests 
  131. dCtlEnable                        EQU        2                    ; set if driver responds to control requests 
  132. dStatEnable                        EQU        3                    ; set if driver responds to status requests 
  133. dNeedGoodBye                    EQU        4                    ; set if driver needs time for performing periodic tasks 
  134. dNeedTime                        EQU        5                    ; set if driver needs time for performing periodic tasks 
  135. dNeedLock                        EQU        6                    ; set if driver must be locked in memory as soon as it is opened 
  136. dNeedLockMask                    EQU        $4000                ; set if driver must be locked in memory as soon as it is opened 
  137. dNeedTimeMask                    EQU        $2000                ; set if driver needs time for performing periodic tasks 
  138. dNeedGoodByeMask                EQU        $1000                ; set if driver needs to be called before the application heap is initialized 
  139. dStatEnableMask                    EQU        $0800                ; set if driver responds to status requests 
  140. dCtlEnableMask                    EQU        $0400                ; set if driver responds to control requests 
  141. dWritEnableMask                    EQU        $0200                ; set if driver responds to write requests 
  142. dReadEnableMask                    EQU        $0100                ; set if driver responds to read requests 
  143.  
  144. ; run-time flags used in the device control entry 
  145. dOpened                            EQU        5                    ; driver is open 
  146. dRAMBased                        EQU        6                    ; dCtlDriver is a handle (1) or pointer (0) 
  147. drvrActive                        EQU        7                    ; driver is currently processing a request 
  148. drvrActiveMask                    EQU        $0080                ; driver is currently processing a request 
  149. dRAMBasedMask                    EQU        $0040                ; dCtlDriver is a handle (1) or pointer (0) 
  150. dOpenedMask                        EQU        $0020                ; driver is open 
  151.  
  152. DRVRHeader                 RECORD    0
  153. drvrFlags                 ds.w   1        ; offset: $0 (0)
  154. drvrDelay                 ds.w   1        ; offset: $2 (2)
  155. drvrEMask                 ds.w   1        ; offset: $4 (4)
  156. drvrMenu                 ds.w   1        ; offset: $6 (6)
  157. drvrOpen                 ds.w   1        ; offset: $8 (8)
  158. drvrPrime                 ds.w   1        ; offset: $A (10)
  159. drvrCtl                     ds.w   1        ; offset: $C (12)
  160. drvrStatus                 ds.w   1        ; offset: $E (14)
  161. drvrClose                 ds.w   1        ; offset: $10 (16)
  162. drvrName                 ds.b   1        ; offset: $12 (18)
  163.                          ORG 20
  164. sizeof                     EQU *            ; size:   $14 (20)
  165.                         ENDR
  166.  
  167. ; typedef struct DRVRHeader  DRVRHeader
  168. ; typedef DRVRHeader         *DRVRHeaderPtr, **DRVRHeaderHandle
  169. DCtlEntry                 RECORD    0
  170. dCtlDriver                 ds.l   1        ; offset: $0 (0)
  171. dCtlFlags                 ds.w   1        ; offset: $4 (4)
  172. dCtlQHdr                 ds     QHdr    ; offset: $6 (6)
  173. dCtlPosition             ds.l   1        ; offset: $10 (16)
  174. dCtlStorage                 ds.l   1        ; offset: $14 (20)
  175. dCtlRefNum                 ds.w   1        ; offset: $18 (24)
  176. dCtlCurTicks             ds.l   1        ; offset: $1A (26)
  177. dCtlWindow                 ds.l   1        ; offset: $1E (30)
  178. dCtlDelay                 ds.w   1        ; offset: $22 (34)
  179. dCtlEMask                 ds.w   1        ; offset: $24 (36)
  180. dCtlMenu                 ds.w   1        ; offset: $26 (38)
  181. sizeof                     EQU *            ; size:   $28 (40)
  182.                         ENDR
  183.  
  184. ; typedef struct DCtlEntry     DCtlEntry
  185. ; typedef DCtlEntry         *DCtlPtr, **DCtlHandle
  186. AuxDCE                     RECORD    0
  187. dCtlDriver                 ds.l   1        ; offset: $0 (0)
  188. dCtlFlags                 ds.w   1        ; offset: $4 (4)
  189. dCtlQHdr                 ds     QHdr    ; offset: $6 (6)
  190. dCtlPosition             ds.l   1        ; offset: $10 (16)
  191. dCtlStorage                 ds.l   1        ; offset: $14 (20)
  192. dCtlRefNum                 ds.w   1        ; offset: $18 (24)
  193. dCtlCurTicks             ds.l   1        ; offset: $1A (26)
  194. dCtlWindow                 ds.l   1        ; offset: $1E (30)
  195. dCtlDelay                 ds.w   1        ; offset: $22 (34)
  196. dCtlEMask                 ds.w   1        ; offset: $24 (36)
  197. dCtlMenu                 ds.w   1        ; offset: $26 (38)
  198. dCtlSlot                 ds.b   1        ; offset: $28 (40)
  199. dCtlSlotId                 ds.b   1        ; offset: $29 (41)
  200. dCtlDevBase                 ds.l   1        ; offset: $2A (42)
  201. dCtlOwner                 ds.l   1        ; offset: $2E (46)
  202. dCtlExtDev                 ds.b   1        ; offset: $32 (50)
  203. fillByte                 ds.b   1        ; offset: $33 (51)
  204. dCtlNodeID                 ds.l   1        ; offset: $34 (52)
  205. sizeof                     EQU *            ; size:   $38 (56)
  206.                         ENDR
  207.  
  208. ; typedef struct AuxDCE     AuxDCE
  209. ; typedef AuxDCE             *AuxDCEPtr, **AuxDCEHandle
  210. ;
  211. ; pascal DCtlHandle GetDCtlEntry(short refNum)
  212. ;
  213.     IF GENERATINGCFM THEN
  214.         IMPORT_CFM_FUNCTION    GetDCtlEntry
  215.     ENDIF
  216.  
  217. ;
  218. ;    SetChooserAlert used to simply set a bit in a low-mem global
  219. ;    to tell the Chooser not to display its warning message when
  220. ;    the printer is changed. However, under MultiFinder and System 7,
  221. ;    this low-mem is swapped out when a layer change occurs, and the
  222. ;    Chooser never sees the change. It is obsolete, and completely
  223. ;    unsupported on the PowerPC. 68K apps can still call it if they
  224. ;    wish.
  225. ;
  226.     IF OLDROUTINENAMES  ** ¬ GENERATINGCFM  THEN
  227. ;
  228. ; pascal Boolean SetChooserAlert(Boolean f)
  229. ;
  230.     IF GENERATINGCFM THEN
  231.         IMPORT_CFM_FUNCTION    SetChooserAlert
  232.     ENDIF
  233.  
  234.     ENDIF
  235. ;
  236. ;  Note: DrvrInstall() is no longer supported, becuase it never really worked anyways.
  237. ;          There will soon be a DriverInstall() which does the right thing.
  238. ;
  239. ;        DrvrRemove has been renamed to DriverRemove.  But, InterfaceLib for PowerPC
  240. ;        still exports DrvrRemove, so a macro is used to map the new name to old.
  241. ;
  242. ;
  243. ;
  244. ; pascal OSErr DrvrRemove(short refNum)
  245. ;
  246.     IF ¬ GENERATINGCFM THEN
  247.         ; parameters: 
  248.         ;     refNum            => D0
  249.         ; returns: 
  250.         ;     OSErr             <= D0
  251.         _DrvrRemove:    OPWORD    $A03E
  252.     ELSE
  253.         IMPORT_CFM_FUNCTION    DrvrRemove
  254.     ENDIF
  255.  
  256.     IF ¬ GENERATINGCFM THEN
  257.         _Open:             OPWORD      $A000
  258.         _Close:            OPWORD      $A001
  259.         _Read:             OPWORD      $A002
  260.         _Write:            OPWORD      $A003
  261.         _Control:          OPWORD      $A004
  262.         _Status:           OPWORD      $A005
  263.         _KillIO:           OPWORD      $A006
  264.     ENDIF
  265. ;
  266. ; pascal OSErr PBControlSync(ParmBlkPtr paramBlock)
  267. ;
  268.     IF ¬ GENERATINGCFM THEN
  269.         ; parameters: 
  270.         ;     paramBlock        => A0
  271.         ; returns: 
  272.         ;     OSErr             <= D0
  273.         _PBControlSync:    OPWORD    $A004
  274.     ELSE
  275.         IMPORT_CFM_FUNCTION    PBControlSync
  276.     ENDIF
  277.  
  278. ;
  279. ; pascal OSErr PBControlAsync(ParmBlkPtr paramBlock)
  280. ;
  281.     IF ¬ GENERATINGCFM THEN
  282.         ; parameters: 
  283.         ;     paramBlock        => A0
  284.         ; returns: 
  285.         ;     OSErr             <= D0
  286.         _PBControlAsync:    OPWORD    $A404
  287.     ELSE
  288.         IMPORT_CFM_FUNCTION    PBControlAsync
  289.     ENDIF
  290.  
  291. ;
  292. ; pascal OSErr PBControlImmed(ParmBlkPtr paramBlock)
  293. ;
  294.     IF ¬ GENERATINGCFM THEN
  295.         ; parameters: 
  296.         ;     paramBlock        => A0
  297.         ; returns: 
  298.         ;     OSErr             <= D0
  299.         _PBControlImmed:    OPWORD    $A204
  300.     ELSE
  301.         IMPORT_CFM_FUNCTION    PBControlImmed
  302.     ENDIF
  303.  
  304. ;
  305. ; pascal OSErr PBStatusSync(ParmBlkPtr paramBlock)
  306. ;
  307.     IF ¬ GENERATINGCFM THEN
  308.         ; parameters: 
  309.         ;     paramBlock        => A0
  310.         ; returns: 
  311.         ;     OSErr             <= D0
  312.         _PBStatusSync:    OPWORD    $A005
  313.     ELSE
  314.         IMPORT_CFM_FUNCTION    PBStatusSync
  315.     ENDIF
  316.  
  317. ;
  318. ; pascal OSErr PBStatusAsync(ParmBlkPtr paramBlock)
  319. ;
  320.     IF ¬ GENERATINGCFM THEN
  321.         ; parameters: 
  322.         ;     paramBlock        => A0
  323.         ; returns: 
  324.         ;     OSErr             <= D0
  325.         _PBStatusAsync:    OPWORD    $A405
  326.     ELSE
  327.         IMPORT_CFM_FUNCTION    PBStatusAsync
  328.     ENDIF
  329.  
  330. ;
  331. ; pascal OSErr PBStatusImmed(ParmBlkPtr paramBlock)
  332. ;
  333.     IF ¬ GENERATINGCFM THEN
  334.         ; parameters: 
  335.         ;     paramBlock        => A0
  336.         ; returns: 
  337.         ;     OSErr             <= D0
  338.         _PBStatusImmed:    OPWORD    $A205
  339.     ELSE
  340.         IMPORT_CFM_FUNCTION    PBStatusImmed
  341.     ENDIF
  342.  
  343. ;
  344. ; pascal OSErr PBKillIOSync(ParmBlkPtr paramBlock)
  345. ;
  346.     IF ¬ GENERATINGCFM THEN
  347.         ; parameters: 
  348.         ;     paramBlock        => A0
  349.         ; returns: 
  350.         ;     OSErr             <= D0
  351.         _PBKillIOSync:    OPWORD    $A006
  352.     ELSE
  353.         IMPORT_CFM_FUNCTION    PBKillIOSync
  354.     ENDIF
  355.  
  356. ;
  357. ; pascal OSErr PBKillIOAsync(ParmBlkPtr paramBlock)
  358. ;
  359.     IF ¬ GENERATINGCFM THEN
  360.         ; parameters: 
  361.         ;     paramBlock        => A0
  362.         ; returns: 
  363.         ;     OSErr             <= D0
  364.         _PBKillIOAsync:    OPWORD    $A406
  365.     ELSE
  366.         IMPORT_CFM_FUNCTION    PBKillIOAsync
  367.     ENDIF
  368.  
  369. ;
  370. ; pascal OSErr PBKillIOImmed(ParmBlkPtr paramBlock)
  371. ;
  372.     IF ¬ GENERATINGCFM THEN
  373.         ; parameters: 
  374.         ;     paramBlock        => A0
  375.         ; returns: 
  376.         ;     OSErr             <= D0
  377.         _PBKillIOImmed:    OPWORD    $A206
  378.     ELSE
  379.         IMPORT_CFM_FUNCTION    PBKillIOImmed
  380.     ENDIF
  381.  
  382. ;
  383. ; pascal short OpenDeskAcc(ConstStr255Param deskAccName)
  384. ;
  385.     IF ¬ GENERATINGCFM THEN
  386.         _OpenDeskAcc:    OPWORD    $A9B6
  387.     ELSE
  388.         IMPORT_CFM_FUNCTION    OpenDeskAcc
  389.     ENDIF
  390.  
  391. ;
  392. ; pascal void CloseDeskAcc(short refNum)
  393. ;
  394.     IF ¬ GENERATINGCFM THEN
  395.         _CloseDeskAcc:    OPWORD    $A9B7
  396.     ELSE
  397.         IMPORT_CFM_FUNCTION    CloseDeskAcc
  398.     ENDIF
  399.  
  400.     ENDIF ; __DEVICES__
  401.